import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    isLogin:false,
    user : {
      userId:'',
      name:'',
      email:'',
      // admin:'',
    }
  },
  mutations: {
    login(state, payload){
      state.user.userId = payload.userId
      state.user.name = payload.name
      state.user.email = payload.email
      // state.user.admin = payload.admin

      state.isLogin = true
    },
    logout(state){
      Object.keys(state.user).forEach((key) => {
        state.user[key] = ''
      })
      state.isLogin = false
    }
  },
  actions: {
  },
  modules: {
  }
})
